Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expose redirect URL from Apache Shiro back to React #778

Merged
merged 10 commits into from
Sep 25, 2024

Conversation

JasonWildMe
Copy link
Contributor

@JasonWildMe JasonWildMe commented Sep 23, 2024

This PR allows a Wildbook URL to a secured endpoint to be entered and then redireted back to after login.

For example, /appadmin/dataIntegrity.jsp is secured, and a public request to it should be redirected to /react/login/ before returning the user to /appadmin/dataIntegrity.jsp.

PR fixes #675

Changes

  • Part 1: @JasonWildMe adds the "redirectURL" parameter to Login.java's returned JSON payload
  • Part 2: @erinz2020 ensures /react/login/ page does not make any calls to the backend Java
    • remove call to /Collaborate if user is not yet logged in. This interferes with our ability to get the redirect URL.
    • remove call to /UserGetNotifications if user is not yet logged in. This interferes with our ability to get the redirect URL.
  • Part 3: @erinz2020 If JSON payload response from Login includes a "redirectUrl" value (e.g., "/appadmin/dataIntegrity.jsp"), redirect to that URL.
  • Part 4: @erinz2020 add a spinner on login button to display the status of loading since redirecting might take time

some test points:

  1. login/logout normally
  2. access protected jsp pages in logged out state, e.g. /individualSearchResults.jsp?username=test etc
  3. access protected react pages in logged out state, e.g. /react/encounter-search?username=test&state=unapproved
  4. access url that contains searchQueryId, e.g. encounters/thumbnailSearchResults.jsp?searchQueryId=8cdb3e02-e199-4322-bf80-180168bd1b35&regularQuery=true
  5. access url that contains hash

@TanyaStere42 TanyaStere42 changed the title Part 1: expose redirect URL from Apache Shiro back to React expose redirect URL from Apache Shiro back to React Sep 23, 2024
@erinz2020 erinz2020 force-pushed the issue-675-url-redirect-after-login branch from 150151f to 0216590 Compare September 25, 2024 20:33
@erinz2020 erinz2020 marked this pull request as ready for review September 25, 2024 21:35
@erinz2020 erinz2020 marked this pull request as draft September 25, 2024 21:52
@erinz2020 erinz2020 marked this pull request as ready for review September 25, 2024 22:00
@JasonWildMe
Copy link
Contributor Author

Overall, looks good to me.

Copy link
Member

@TanyaStere42 TanyaStere42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

everybody's happy with the changes 👍

@TanyaStere42 TanyaStere42 merged commit 50cda8c into main Sep 25, 2024
1 check passed
@TanyaStere42 TanyaStere42 deleted the issue-675-url-redirect-after-login branch September 25, 2024 23:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a React-compatible redirect after login utility
4 participants